package com.winspread.app

import android.widget.TextView
import com.blankj.utilcode.util.ActivityUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.winspread.app.AutoCompleteTextVeiw.AutoEdittextActivity
import com.winspread.app.appbarlayoutui.AppBarLayoutActivity
import com.winspread.app.databinding.ActivityMainBinding
import com.winspread.app.drawable.CustomBallActivity
import com.winspread.app.flow.FlowActivity
import com.winspread.app.flowlayout.FlowLayoutActivity
import com.winspread.app.fragment.FragmentActivity
import com.winspread.app.hitl.HiltActivity
import com.winspread.app.lottie.LottieActivity
import com.winspread.app.map.MapTestActivity
import com.winspread.app.paging.PagingActivity
import com.winspread.app.popspinner.PopSpinnerViewActivity
import com.winspread.app.power.PowerActivity
import com.winspread.app.roundimage.RoundImageActivity
import com.winspread.app.scanview.ScanViewActivity
import com.winspread.app.ui.DialogActivity
import com.winspread.app.ui.EditTextActivity
import com.winspread.app.ui.ToastActivity
import com.winspread.app.viewpager.ViewPager2Activity
import com.winspread.app.web.WebActivity
import com.winspread.mvvm.base.vm.BaseNotVmActivity


/**
 *Author: Amin
 *Data: 2021/9/28 14:29
 *
 *Description:
 *
 */
class MainActivity : BaseNotVmActivity<ActivityMainBinding>(R.layout.activity_main) {

    var mActivitys = mutableMapOf(
        "AppBarLayout" to AppBarLayoutActivity::class.java,
        "BaseDialog" to DialogActivity::class.java,
        "EditTextActivity" to EditTextActivity::class.java,
        "LottieActivity" to LottieActivity::class.java,
        "ToastActivity" to ToastActivity::class.java,
        "HiltActivity" to HiltActivity::class.java,
        "FlowActivity" to FlowActivity::class.java,
        "FragmentActivity" to FragmentActivity::class.java,
        "CustomBallActivity" to CustomBallActivity::class.java,
        "MapTestActivity" to MapTestActivity::class.java,
        "RoundImageActivity" to RoundImageActivity::class.java,
        "AutoEdittextActivity" to AutoEdittextActivity::class.java,
        "PopSpinnerViewActivity" to PopSpinnerViewActivity::class.java,
        "FlowLayoutActivity" to FlowLayoutActivity::class.java,
        "WebActivity" to WebActivity::class.java,
        "PagingActivity" to PagingActivity::class.java,
        "ViewPager2" to ViewPager2Activity::class.java,
        "PowerActivity" to PowerActivity::class.java,
        "ScanViewActivity" to ScanViewActivity::class.java,
    )




    override fun initView() {
        binding.recyclerview.adapter = object : BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_text, mActivitys.keys.toMutableList()) {
            override fun convert(holder: BaseViewHolder, item: String) {
                holder.getView<TextView>(R.id.item_tv)?.let {
                    it.text = item
                    it.setOnClickListener {
                        mActivitys[item]?.let { v -> ActivityUtils.startActivity(v) }
                    }
                }
            }
        }
    }


}